<template>
  <div>
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="用户管理" name="1"></el-tab-pane>
      <el-tab-pane label="医生管理" name="2"></el-tab-pane>
      <el-tab-pane label="建管师管理" name="3"></el-tab-pane>
    </el-tabs>
    <div v-if="activeName == 1">
      <el-button @click="toPaiban">导入排版</el-button>
      <el-button type="primary">维护历史</el-button>
    </div>
    <div v-if="activeName == 2">
      <el-button @click="toPaiban">导入排版</el-button>
      <el-button type="primary">维护历史</el-button>
    </div>
    <div v-if="activeName == 3">
      <el-button @click="toPaiban">导入排版</el-button>
      <el-button type="primary">维护历史</el-button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      activeName: "1",
    };
  },
  methods: {
    toPaiban() {
      this.$router.push({
        path: "/paiban",
        query: {
          type: this.activeName,
        },
      });
    },
    handleClick() {
      let tagName = sessionStorage.setItem("cacheActiveName", this.activeName);
      this.activeName = tagName || "1";
    },
  },
  mounted() {
    this.activeName = sessionStorage.getItem("cacheActiveName");
  },
  watch: {
    activeName: {
      immediate: true,
      handler() {
        console.log(this.activeName + "跟新了");
      },
    },
  },
};
</script>
<style scoped></style>
